load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library")
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_proto_library")
load("@rules_proto//proto:defs.bzl", "proto_library")

proto_library(
    name = "echo_proto",
    srcs = [
        "echo.proto",
    ],
)

# Server

cc_proto_library(
    name = "echo_cc_proto",
    deps = [
        ":echo_proto",
    ],
)

cc_grpc_library(
    name = "echo_cc_grpc",
    srcs = [
        ":echo_proto",
    ],
    grpc_only = True,
    deps = [
        ":echo_cc_proto",
    ],
)

cc_binary(
    name = "server",
    srcs = [
        "echo_server.cc",
        "echo_service_impl.cc",
        "echo_service_impl.h",
    ],
    deps = [
        ":echo_cc_grpc",
        ":echo_cc_proto",
        "@com_github_grpc_grpc//:grpc++",
    ],
)
